package com.lyz.ehcachedome;

import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Element;

public class EhcacheDome {
    public static void main(String[] args) {
//        获取cacheManager
        CacheManager cacheManager = CacheManager.create();
//        获取cache实例
        Cache cacheOne = cacheManager.getCache("cacheOne");
//        将数据放入缓存
        Element element = new Element("key1", "雷雷");
        cacheOne.put(element);

        System.out.println(cacheOne.get("key1"));
//        清除缓存特定条目
        cacheOne.remove("key1");

//      关闭CacheManager
        cacheManager.shutdown();
    }
}
